package tt.dz.order.pojo;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;
import tt.dz.order.util.OrderConstant.BizSystemCode;

/**
 * @Title 订单系统角色信息，对应pub_role
 * @author zhoutian   
 * @date 2015-12-25
 */
public class SysRole {
	//角色ID
	private String roleId;
	//业务系统编码
	private String sysCode;
	//角色名称
	private String roleName;
	//角色备注
	private String remark;
	//创建人
	private String creator;
	//创建时间
	private Date createTime;
	//有效标识,0:无效 1:有效
	private int isValid;

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public String getSysCode() {
		return sysCode;
	}

	public void setSysCode(String sysCode) {
		this.sysCode = sysCode;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public int getIsValid() {
		return isValid;
	}

	public void setIsValid(int isValid) {
		this.isValid = isValid;
	}

	public SysRole() {}
	
	private static final String select_all_sql = "select role_id as roleId, sys_code as sysCode, role_name as roleName, remark, created_by as creator, created_time as createTime, is_valid as isValid from pub_role";
	
	public static List<SysRole> getAll(){
		String sql = select_all_sql + " where sys_code = :sysCode and is_valid = 1";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("sysCode", BizSystemCode.OrderServer.value());
		return BaseDAOUtil.queryForList(sql, params, SysRole.class);
	}
}
